﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


public class Resource : IDisposable
{
    private bool available;
    private int  number;
    private static int usedSoFar=0;
    private string info;

    public string Info
    {
        get { return info; }
        set { info = value; }
    }

    public int Number
    {
        get { return number; }
    }

    public bool Available
    {
        get { return available; }
        set { this.available = value; }
    }

    private Resource(int number)
    {
        this.number = number;
        this.available = true;
    }

    public static Resource GetResource()
    {
        Resource resource = new Resource(usedSoFar++);
        return resource;
    }

    ~Resource()
    {
        Dispose(true);
    }

    public void Dispose()
    {
        Dispose(false);
        GC.SuppressFinalize(this);
    }

    public void Dispose(bool disposable)
    {
        this.Available = true;
    }

    public override string ToString()
    {
        return this.Number.ToString();
    }
}

